#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Elasticseach搜索demo
from datetime import datetime
from elasticsearch import Elasticsearch

es = Elasticsearch(hosts="10.10.10.51", port="9200")

# es.index(index="my-index", doc_type="test-type", id=42, body={"any": "data", "timestamp": datetime.now()})
# {u'_id': u'42', u'_index': u'my-index', u'_type': u'test-type', u'_version': 1, u'ok': True}

result = es.get(index="cobarc", doc_type="order", id=56496840)['_source']
{u'any': u'data'}
print  result
